<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button id="btnLogin">登录</button>
    <script>
      //异步的,异步IO
      // setTimeout(() => {
      //   console.log("A、2000毫秒后你可以看到控制台输出该消息");
      // }, 2000);

      // console.log("B、2000毫秒后你可以看到控制台输出该消息");

      function sleep(millSeconds) {
        let time = new Date().getTime();
        while (new Date().getTime() <= time + millSeconds);
      }

      for (var i = 0; i < 10; i++) {
        console.log(i);
        sleep(2000);
      }
    </script>
  </body>
</html>
